import 'package:flutter/services.dart';

class NativeMethodChannel {
  static const MethodChannel _methodChannel =
      MethodChannel("native_controller_channel");

  /// 展示开屏广告
  static Future<bool> showSplashAd() async {
    return await invokeMethod("showSplashAd");
  }

  /// 展示插屏广告
  static Future<bool> showInterstitialAd() async {
    return invokeMethod("showInterstitialAd");
  }

  /// Flutter通知其他端
  static Future<bool> invokeMethod(String method,
      {Map<String, dynamic>? arguments}) async {
    try {
      return await _methodChannel.invokeMethod(method, arguments ?? []);
    } catch (e) {
      print(e);
    }
    return false;
  }
}
